package org.alex.netShop.beans;

import java.util.LinkedList;
import java.util.List;

import org.alex.netShop.interfaces.Customer;
import org.alex.netShop.interfaces.Product;
import org.alex.netShop.interfaces.Purchase;
import org.alex.netShop.interfaces.Seller;
import org.alex.netShop.service.PurchaseUniqueID;
import org.alex.netShop.service.Purchases;






public class PurchaseBean implements  Purchase {
	
	private Customer customer;
	private Seller seller;
	private List<Product> product;
	private String id;
	
	public Customer getCustomer() {
		return customer;
	}
	
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	public Seller getSeller() {
		return seller;
	}
	
	public void setSeller(Seller seller) {
		this.seller = seller;
	}
	
	
	public List<Product> getProduct() {
		return product;
	}

	public void setProduct(List<Product> product) {
		this.product = product;
	}

	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void executeBorrowCreation(Seller seller, Customer customer, Product product, Purchases purchases){
		
		
		this.setId(PurchaseUniqueID.getPurchaseUniqueID());
		this.setSeller(seller);
		this.setCustomer(customer);
		List<Product> p = new LinkedList<Product>();
		p.add(product);
		
		this.setProduct(p);
				
		seller.getPurchase().add(this);
		product.getPurchase().add(this);
		customer.getPurchase().add(this);
		
		purchases.save(this);

	}
}
